package com.jwater.core.manager.master.event;

import com.jwater.core.serialize.SerializeUtils;

/**
 * @description:工作进程登录事件
 * @author: jnner
 * @createDate: 2021/2/5
 * @version: 1.0
 */
public class LoginEvent extends GroupEvent {
    private String regionName;
    private String deployName;
    private String groupName;
    private String workerName;
    private int index;
    private long loginTime;
    private long startTime;
    private String host;
    private String envsString;

    @Override
    public String getType() {
        return GroupEvent.TYPE_LOGIN;
    }

    @Override
    public byte[] serialize() {
        return SerializeUtils.serializeArray(regionName, deployName, groupName, workerName, index, loginTime,
                startTime, host, envsString);
    }

    @Override
    public LoginEvent deserialize(byte[] data) {
        Object[] objs = SerializeUtils.deserializeArray(data);
        this.regionName = (String) objs[0];
        this.deployName = (String) objs[1];
        this.groupName = (String) objs[2];
        this.workerName = (String) objs[3];
        this.index = (int) objs[4];
        this.loginTime = (long) objs[5];
        this.startTime = (long) objs[6];
        this.host= (String) objs[7];
        this.envsString= (String) objs[8];
        return this;
    }

    public String getRegionName() {
        return regionName;
    }

    public void setRegionName(String regionName) {
        this.regionName = regionName;
    }

    public String getDeployName() {
        return deployName;
    }

    public void setDeployName(String deployName) {
        this.deployName = deployName;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getWorkerName() {
        return workerName;
    }

    public void setWorkerName(String workerName) {
        this.workerName = workerName;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public long getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(long loginTime) {
        this.loginTime = loginTime;
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getEnvsString() {
        return envsString;
    }

    public void setEnvsString(String envsString) {
        this.envsString = envsString;
    }
}
